#include <bits/stdc++.h>

#define in read()
#define fi first
#define se second
#define pb push_back

using namespace std;

using pii = pair < int , int >;
using vec = vector < int >;
using veg = vector < pii >;
using ll = long long;
using db = double;

int read() {
    int x = 0; bool f = 0; char ch = getchar(); while(!isdigit(ch)) f |= ch == '-',ch = getchar();
    while(isdigit(ch)) x = x * 10 + (ch ^ 48),ch = getchar(); return f ? -x : x;
}

const int N = 2010;

int n;
int pot[N],lg[N << 1];
bool vis[N << 2];

void solve() {
	n = in; memset(vis,0,sizeof vis);
	vis[0] = true; int cur = 0,lim = 1;
	for(;(1 << lim) <= n;lim++);
	lg[0] = lg[1] = 0; for(int i = 2;i < 1 << lim;i++) lg[i] = lg[i >> 1] + 1;
	for(int i = 1;i <= n;i++) {
		for(int j = 0;j < lim;j++) if(!vis[cur ^ 1 << j]) { vis[cur ^ 1 << j] = true; cur ^= 1 << j; break; }
		pot[i] = cur;
	}
	for(int i = 1;i <= n;i++) {
		int x = pot[i] ^ pot[i - 1]; //cerr << x << " " ;
		assert((1 << lg[x]) == x);
		printf("%d ",lg[x] + 1); 
	} puts("");
}

int main() {
#ifndef ONLINE_JUDGE
    freopen("1.in","r",stdin);
#endif
    for(int t = in;t;t--) solve(); return 0;
}
